import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { TaskDailyConfigVO, TaskDailyConfigForm, TaskDailyConfigQuery } from '@/api/config/taskDailyConfig/types';

/**
 * 查询日常任务自动生成配置列表
 * @param query
 * @returns {*}
 */

export const listTaskDailyConfig = (query?: TaskDailyConfigQuery): AxiosPromise<TaskDailyConfigVO[]> => {
  return request({
    url: '/config/taskDailyConfig/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询日常任务自动生成配置详细
 * @param id
 */
export const getTaskDailyConfig = (id: string | number): AxiosPromise<TaskDailyConfigVO> => {
  return request({
    url: '/config/taskDailyConfig/' + id,
    method: 'get'
  });
};

/**
 * 新增日常任务自动生成配置
 * @param data
 */
export const addTaskDailyConfig = (data: TaskDailyConfigForm) => {
  return request({
    url: '/config/taskDailyConfig',
    method: 'post',
    data: data
  });
};

/**
 * 修改日常任务自动生成配置
 * @param data
 */
export const updateTaskDailyConfig = (data: TaskDailyConfigForm) => {
  return request({
    url: '/config/taskDailyConfig',
    method: 'put',
    data: data
  });
};

/**
 * 删除日常任务自动生成配置
 * @param id
 */
export const delTaskDailyConfig = (id: string | number | Array<string | number>) => {
  return request({
    url: '/config/taskDailyConfig/' + id,
    method: 'delete'
  });
};
